package com.toubutu.audio.admin.dto;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.toubutu.audio.common.QueryBaseDto;
import com.toubutu.audio.entity.Comment;
import com.toubutu.constants.BaseConstants;
import io.netty.util.internal.StringUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

/**
 * @author 朱鹏杰
 * @version 1.0
 * @date 2024年03月02日 0:07
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class AdminPageQueryComment extends QueryBaseDto<Comment> {

    private Integer commentId;
    private Long userId;
    private String videoCode;
    @Override
    public LambdaQueryWrapper<Comment> getWrapper() {
        LambdaQueryWrapper<Comment> wrapper = new LambdaQueryWrapper<>();
        if (commentId!=null){
            wrapper.eq(Comment::getId,userId);
        }
        if (userId!=null){
            wrapper.eq(Comment::getUserId,userId);
        }
        if (StringUtils.isNotBlank(videoCode)){
            wrapper.eq(Comment::getVideoCode,videoCode);
        }
        wrapper.eq(Comment::getIsDelete, BaseConstants.UN_DELETED);
        return wrapper;
    }
}
